<?php
/*
 * 生成多分站选择json
 * @author     Mark <zhaody901@126.com>
 * @copyright  Copyright (c) 2013 lemon team
 * @version    $Id: cb74135cd0702ffb1a083d43bd61a24c91af5b45 $
 * @time       14-2-7 上午10:09
 */
include '../../common.inc.php';
$str=array();
foreach($AREA as $k=>$v){
	if($v['parentid']==0){
		$str[$k]['id']=$v['areaid'];
		$str[$k]['name']=$v['areaname'];
		$child=explode(',',$v['arrchildid']);
		if(!$AREA[$child[1]]['child']){
			$str[$k]['noChild']="true";
		}else{
			foreach($child as $t){
				if($t!=$k && $AREA[$t]['child']){
					$tmp['id']=$AREA[$t]['areaid'];
					$tmp['name']=$AREA[$t]['areaname'];
					$str[$k]['cities'][]=$tmp;
				}
			}
		}
	}
}
$are['provs']=$str;
$are['provs']=array_values($are['provs']);
echo json_encode($are);